package com.Day1008;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Scanner;
import java.util.Set;

public class Text1 {
    public static void main(String[] args) {
        //   现有数组 ： 2 4 5 2 6 6 9
        //   去重复  ：  2 4 5 6 9
        int[] nums = {2,4,5,2,6,6,9};
        Set set = new HashSet();
        for (int nums1 : nums) {
            set.add(nums1);
        }
        System.out.println("新数组长度：" + set.size());
//        Iterator iterator = set.iterator();
//        while (iterator.hasNext()){
//            System.out.print(iterator.next() + " ");
//        }
        for (Object st : set) {
            System.out.print(st + " ");
        }
    }
}
